using System;
using System.Collections;
using System.Collections.Generic;
using UnityEngine;
using UnityEngine.Serialization;

public class TestLiHuaAnimator : MonoBehaviour
{
    public Animator animator;
    private void OnGUI()
    {
        string state_name = "idle";
        if (GUILayout.Button($"Animator to state_name[{state_name}]"))
        {
            BdPackage.BdUtils.log("state_name:", state_name);
            BdPackage.BdUtils.assert(BdTools.has_animation_state(animator, state_name), $"`animator`没有`state_name[{state_name}]`?");
            animator.Play(state_name);
        }

        state_name = "stop";
        if (GUILayout.Button($"Animator to state_name[{state_name}]"))
        {
            BdPackage.BdUtils.log("state_name:", state_name);
            BdPackage.BdUtils.assert(BdTools.has_animation_state(animator, state_name), $"`animator`没有`state_name[{state_name}]`?");
            animator.Play(state_name);
        }
        
        state_name = "shift";
        if (GUILayout.Button($"Animator to state_name[{state_name}]"))
        {
            BdPackage.BdUtils.assert(BdTools.has_animation_state(animator, state_name), $"`animator`没有`state_name[{state_name}]`?");
            // BdPackage.BdUtils.log("state_name:", state_name);
            animator.Play(state_name);
        }        
        state_name = "BeHit";
        if (GUILayout.Button($"Animator to state_name[{state_name}]"))
        {
            BdPackage.BdUtils.assert(BdTools.has_animation_state(animator, state_name), $"`animator`没有`state_name[{state_name}]`?");
            // animator.Play(state_name);
            animator.SetBool(state_name, true);
        }
    }
}
